package package1;

import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;

public class TestUtil {

    public static void main(String[] args) throws InvocationTargetException, IllegalAccessException {
        CalculatorTest calculatorTest = new CalculatorTest();
        run(calculatorTest);
    }

    // 注解的解析程序
    private static void run(CalculatorTest calculatorTest) throws InvocationTargetException, IllegalAccessException {
        for(Method m : calculatorTest.getClass().getMethods()){
            Test t = m.getDeclaredAnnotation(Test.class);
            if(t != null && !t.ignore()){
                m.invoke(calculatorTest);
            }
        }
    }
}
